<%@page import="mp3seller.entities.Admin"%>
<%@page import="mp3seller.entities.Consumer"%>
<%@page import="mp3seller.util.UserInfo"%>
<%@page import="mp3seller.entities.Mp3"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Mp3 Seller</title>
<script type="text/javascript">
	function submitForm(status) {
		document.getElementById("flag").value = status;
		document.forms["consumerform"].submit();
	}
</script>
</head>
<body>
	<form action="/mp3seller/ServletAdmin" method="get" name="consumerform">	
	<input type="hidden" name="flag" id="flag" value="save">
	<jsp:include page = "/geral/index.jsp" />
		<%
			Admin admin = (Admin) request.getAttribute("admin");			
			String operation = request.getParameter("operation");
			if (operation == null || operation.isEmpty() || operation.equalsIgnoreCase("save")) {
				admin = new Admin();
				operation = "save";
			}else{%>				
				<input type="hidden" name="id" id="id" value="<%=admin.getId()%>">
				<%
			}
			boolean isAdmin = false;
			if (request.getAttribute("isAdmin") != null){				
				isAdmin = (Boolean) request.getAttribute("isAdmin");				
			}
		%>		
		
		<h1>Conta</h1>		
		Nome:<input type="text" name="nome" value="<%=admin.getName()%>"><br>
		Login:<input type="text" name="login" value="<%=admin.getLogin()%>"><br>
		Senha:<input type="password" name="pass" value="<%=admin.getPassword()%>"><br>
		Confirmar Senha:<input type="password" name="passc" value="<%=admin.getPassword()%>"><br>
			<%if(operation.equalsIgnoreCase("save")){ %>	
				<input type="button" value="Salvar" onclick="submitForm('<%=operation%>')">
			<%} else {%> 
				<input type="button" value="Atualizar" onclick="submitForm('<%=operation%>')">		
				<input type="button" value="remover" onclick="submitForm('remove')">
			<%} %>		
	</form>
</body>
</html>